﻿using System;

namespace FlickrXplorer.Web.Views.Shared
{
    public class Default : System.Web.Mvc.ViewMasterPage
    {
        protected enum SearchType
        {
            Text,
            Tag,
            User
        }
        protected SearchType TextSearchType = SearchType.Text;
        protected string SearchText { get; set; }
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Url.AbsolutePath.ToLower().IndexOf("/user/") != -1)
            {
                TextSearchType = SearchType.User;
                SearchText = ViewData["User"] as string;
            }
            else
            {
                if (!string.IsNullOrEmpty(Request["q"]))
                {
                    TextSearchType = SearchType.Text;
                }
                SearchText = ViewData["Search"] as string;
            }
                        
            if (!string.IsNullOrEmpty(Request["tag"]))
            {
                TextSearchType = SearchType.Tag;
            }
        }
       
    }
}
